package cn.hxz.bean;

/**
 * 学生实体，生成getter和setter，
 * 生成无参和有参构造，生成toString()
 * 添加课程course 并且生成getter and setter,重新生成toString()
 */
public class Student {
    /**
     * id
     */
    private int id;
    /**
     * 姓名
     */
    private String name;

    //初始化
    public void init() {
        System.out.println("我被初始化了");
    }
    //销毁
    public void destroy() {
        System.out.println("我被销毁了");
    }
    /**
     * 课程信息
     */
    private Course course;

    public Course getCourse() {
        return course;
    }

    public void setCourse(Course course) {
        this.course = course;
    }

    public Student() {
    }

    public Student(int id, String name) {
        this.id = id;
        this.name = name;
    }

    public Student(int id, String name, Course course) {
        this.id = id;
        this.name = name;
        this.course = course;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Override
    public String toString() {
        return "Student{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", course=" + course +
                '}';
    }
}
